home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
MacGofer 0.22d
/
MacGofer Sources
/
storage.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1994-01-06
|
43.2 KB
|
1,335 lines
|
[
TEXT/MPS
]
/* --------------------------------------------------------------------------
* storage.c: Copyright (c) Mark P Jones 1991-1993. All rights reserved.
* See goferite.h for details and conditions of use etc...
* Gofer version 2.28 January 1993
*
* Fixed to use dynamically configurable memory settings.
* KH (17/5/92)
*
* Primitives for manipulating global data structures
* ------------------------------------------------------------------------*/
#include "prelude.h"
#include "storage.h"
#include "connect.h"
#include "errors.h"
#include <setjmp.h>
#if MPW
#pragma segment Storage
#endif
#if MAC
extern Boolean MemoryInstalledOK;
#endif
static List local insertName Args((Name,List));
static Void local patternError Args((String));
static Bool local stringMatch Args((String,String));
static Int local hash Args((String));
static Int local saveText Args((Text));
static Cell local markCell Args((Cell));
static Void local markSnd Args((Cell));
static Cell local indirectChain Args((Cell));
static Void local garbageCollect Args((Void));
static Cell local lowLevelLastIn Args((Cell));
static Cell local lowLevelLastOut Args((Cell));
static Void local closeFile Args((Int));
#if DYNAMIC_STORAGE
Void local Dynamic_Storage_Init Args((Void));
#endif
/* --------------------------------------------------------------------------
* Text storage:
*
* provides storage for the characters making up identifier and symbol
* names, string literals, character constants etc...
*
* All character strings are stored in a large character array, with textHw
* pointing to the next free position. Lookup in the array is improved using
* a hash table. Internally, text strings are represented by integer offsets
* from the beginning of the array to the string in question.
*
* Where memory permits, the use of multiple hashtables gives a significant
* increase in performance, particularly when large source files are used.
*
* Each string in the array is terminated by a zero byte.